import request from '../utils/request'
// 获取权限列表
export const getRights = () => request({
    url: '/rights/list',
})
// 获取角色列表
export const getRoles = () => request({
    url: '/roles',
})
// 添加角色
export const addRoles = (data) => request({
    method: 'POST',
    url: '/roles',
    data
})
// 编辑角色
export const editRoles = (id, roleName, roleDesc) => request({
    method: 'PUT',
    url: `/roles/${id}`,
    data: {
        roleName: roleName,
        roleDesc: roleDesc,
    }
})
// 移除权限
export const removeRights = (roleId, rightId) => request({
    method: 'DELETE',
    url: `roles/${roleId}/rights/${rightId}`,
})
// 删除角色
export const deleteRole = (roleId) => request({
    method: 'DELETE',
    url: `roles/${roleId}`,
})
// 获取权限树
export const getRightsTree = () => request({
    url: 'rights/tree',
})
// 分配权限
export const setNewRights = (roleId, str) => request({
    method: "POST",
    url: `roles/${roleId}/rights`,
    data: {
        rids: str
    }
})
